﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace LabirintoMagicoKinect
{
    [Serializable]
    public class RenderingButton
    {
        public Vector2 mDimension;

        public RenderingButton(Vector2 iDim)
        {
            mDimension = iDim;
        }

        public bool IsMouseOver(Vector2 iPos, Vector2 iMousePos)
        {
            int halfWidth = (int)(mDimension.X / 2.0f);
            int halfHeight = (int)(mDimension.Y / 2.0f);

            Vector2 pos = iPos - new Vector2(halfWidth, halfHeight);

            Rectangle rec = new Rectangle((int)pos.X, (int)pos.Y, halfWidth * 2, halfHeight * 2);
            if (rec.Contains((int)iMousePos.X, (int)iMousePos.Y))
                return true;
            else
                return false;
        }

        public void DrawButton(RenderingData iRender, Texture2D iTexture, Vector2 iPos)
        {
            iRender.DrawTexture(iTexture, mDimension, iPos, 0, Color.White);
        }
    }
}
